// example 9_6

#ifndef QMOVIEPLAYER_H
#define QMOVIEPLAYER_H

#include <QWidget>
#include <opencv2/opencv.hpp>
#include <string>

using namespace std;

namespace Ui {
class QMoviePlayer;
}

class QMoviePlayer : public QWidget
{
    Q_OBJECT

public:
    explicit QMoviePlayer(QWidget *parent = nullptr);
    ~QMoviePlayer();

    bool open(string file);

private:
    Ui::QMoviePlayer *ui;
    cv::VideoCapture m_cap;

    QImage  m_qt_img;
    cv::Mat m_cv_img;
    QTimer* m_timer;

    void paintEvent(QPaintEvent* q);
    void _copyImage(void);

public slots:
    void nextFrame();
};

#endif // QMOVIEPLAYER_H
